﻿using System.Drawing;
using System.Drawing.Imaging;

class Example_SetTIFFCompression
{
    public void Compress(string source, string destination, int quality, ImageCodecInfo myImageCodecInfo)
    {
        Bitmap myBitmap = new Bitmap(source);        

        Encoder myEncoder = Encoder.Quality;
        EncoderParameters myEncoderParameters = new EncoderParameters(1);

        EncoderParameter myEncoderParameter = new EncoderParameter(
            myEncoder,
            quality);
        myEncoderParameters.Param[0] = myEncoderParameter;
        myBitmap.Save(destination, myImageCodecInfo, myEncoderParameters);
    }

}